<!--
	作者：2575202388@qq.com
	时间：2018-10-14
	描述：社团活动辅导班报名情况搜索
-->
<template>
    <div style="width:100%;"> 
        <Tetable ref="tdtable" height="450" :columns="columns9" type="post" 
        	:paramiters="tj" 
        	:serverUrl="serverUrl"
        	@getSelection="getSelection"></Tetable>
        	<shenhe ref="shenhe" :shparams="shparams" v-on:sureShqk="sureShqk"></shenhe>
        	<look ref="look" :params="lparams" ></look>
        	<setjffs ref="setjffs" v-on:setjffs="setjffs"></setjffs>   
    </div> 
</template>
<script>
	import shck from "./shck";
	import shenhe from "./shenhe";
	import look from "./look";
	import sfjs from "./sfjs";
	import setjffs from "./setjffs";
	import _config from "../../../../../../config/config"
    export default {
    	name: "sthdfdbbmqkss",
    	props: {
    		tj:{
    			type: Object
    		}
    	},
        data () {
            return {
            	serverUrl:"/host/stgl/bmqk/Search_sthdbmqkNowByid.html",
                columns9: [
                    {
                        type: 'selection',
                        width: 60,
                        align: 'center'
                    },{
                        type: 'index',
                        width: 60,
                        title: '序号',
                        align: 'center'
                    },{
                        title: '学生姓名',
                        key: 'SNAME',
                        align: 'center'
                    },
                    {
                        title: '审核情况',
                        key: 'SHQKT',
                        align: 'center'
                    },
                    {
                        title: '总费用',
                        key: 'ALLPRICE',
                        align: 'center'
                    },
                    {
                        title: '是否缴费',
                        key: 'SFJFT',
                        align: 'center',
                        render: (h, params) => {
                        	
                        	return h(sfjs, { 
                        		props: {
                                    wstate: params.row.SSTATE+"",
                                    sfjf: params.row.SFJF+"",
                                    shqk: params.row.SHQK+"",
                                    sfjft:params.row.SFJFT
                                },
	                        	on: { 
	                        		updatejffs: () => {
	                        			this.oid=params.row.OID;
	                        			this.$refs.setjffs.modal0=true;
	                        		}
	                        	} 
                        	})

                        }
                    },
                     {
                        title: '缴费方式',
                        key: 'JFFS',
                        align: 'center'     
                    },
                    {
                        title: '操作',
                        key: 'action',
                        width: 200,
                        align: 'center',
                        render: (h, params) => {
                            return h(shck, {
                            	props: {
                                    sstate: params.row.SSTATE+"",
                                    shqk: params.row.SHQK+"",
                                },
                            	on: {
                            		 //审核
                                    shenhe: () => {
                                    	const rows=params.row;
                                    	
                                    	const bmzl=rows.bmzl;
                                    	const bmzlarr=[];
                                    	for(var i=0;i<bmzl.length;i++){
                                    		const bm={
                                    			zlid:bmzl[i].ZLID,
                                    			bid:bmzl[i].BID,
                                    			url:bmzl[i].URL
                                    		}
                                    		bmzlarr.push(bm);
                                    	}
                                    	
                                        this.shparams={
                                        	bid:rows.BID,
                                        	sid:rows.SID,
                                        	sname:rows.SNAME,
                                        	sfzh:rows.SFZH,
                                        	cyear:rows.CYEAR,
                                        	bmqksm:rows.BMQKSM,
                                        	bmzl:bmzlarr
                                        }
                                        this.$refs.shenhe.modal0=true;
                                    },
                                    //查看
                                    look: () =>{
                                    	const rows=params.row;
                                    	
                                    	//报名资料
                                    	const bmzl=rows.bmzl;
                                    	const bmzlarr=[];
                                    	for(var i=0;i<bmzl.length;i++){
                                    		const bm={
                                    			url:_config._ADMIN_SERVER+"/stgl/"+bmzl[i].URL
                                    		}
                                    		bmzlarr.push(bm);
                                    	}
                                    	
                                    	//项目
										const stksf=rows.stksf;
                                    	const xms=[];
                                    	for(var i=0;i<stksf.length;i++){
                                    		const xm={
                                    			xmmc:stksf[i].XMMC,
                                    			fee:stksf[i].FEE
                                    		}
                                    		xms.push(xm);
                                    	}
                                    	
        								//教师
										const stkteacher=rows.stkteacher;
                                    	const tes=[];
                                    	for(var i=0;i<stkteacher.length;i++){
                                    		const te={
                                    			tname:stkteacher[i].TNAME,
                                    			jianjie:stkteacher[i].JIANJIE
                                    		}
                                    		tes.push(te);
                                    	}
        
        								//学生缴费的项目
										const jfxm=rows.jfxm;
                                    	const jfxms=[];
                                    	for(var i=0;i<jfxm.length;i++){
                                    		const xsjf={
                                    			xmmc:jfxm[i].XMMC,
                                    			fee:jfxm[i].FEE
                                    		}
                                    		jfxms.push(xsjf);
                                    	}
                                    	
                                        this.lparams={
                                        	mc:rows.MC,
                                        	jj:rows.JJ,
                                        	fy:rows.FY,
                                        	xe:rows.XE,
                                        	sksj:rows.SKSJ,
											skdd:rows.SKDD,
                                        	bmqksm:rows.BMQKSM,
                                        	bmzlsm:rows.BMZLSM,
                                        	xms:xms,
                                        	tes:tes,
                                        	jfxms:jfxms,
                                        	photos:bmzlarr
                                        }
                                        this.$refs.look.modal0=true;
                                    	
                                    },
                                    
                                    remove: () =>{
                                    	const rows=params.row;
                                        this.remove(rows.BID)
                                    },
                                    
                                }
                            });
                        }
                    }
                ],
                shparams:{},
                lparams:{}
            }
        },
        computed: {
		},
		methods: {

			load(){
				this.$refs.tdtable.load();
			},

			getSelection(datas){
				var selects=[...datas];
				this.$emit('getSelection',selects);
			},
			
			sureShqk(datas){
				const params={...datas};
				//保存
				this.$http.post("/host/stgl/bmqk/bmqk_sh.html",params)
				.then(result => {
					//添加成功 刷新页面
					if(result){
						this.$Modal.success({
                            title: "成功",
                            content: "审核成功！",
                            onOk: () => {
                            	this.$refs.shenhe.modal0=false;
                            	this.load();
                            }
                       });
					}else{
						this.$Modal.error({
                            title: "失败",
                            content: "审核失败！"
                        });	
					}
				});
				
			},
				
			setjffs(jffs){
				const params={
					jffs:jffs,
					oid:this.oid
				};
				this.$Modal.confirm({
                    title: '警告',
                    content: '请确定用户已经缴费！！！',
                    onOk: () => {
                    	this.$http.post("/host/stgl/bmqk/setjffs.html",params)
						.then(result => {
							this.$Message.info('修改成功');
							this.$refs.setjffs.modal0=false;
							this.load();
						});
                    }
                });
			},
			
			
			//删除报名
			remove:function(bid){
                this.$Modal.confirm({
                    title: '警告',
                    content: '请确定是否删除！！！',
                    onOk: () => {
                    	//执行删除代码
                    	this.$http.get("/host/stgl/bmqk/del_bmqkBybid.html?bid="+bid)
						.then(result => {
							//删除成功 刷新页面
							if(result.result){
								this.$Message.info('删除成功');
								this.load();
							}else{
								this.$Modal.error({
			                        title: "失败",
			                        content: result.msg
			                    });	
							}
						});
                    }
                });
			},
			
	    },
		mounted() {
		},
		watch:{
		},
		components: {
			shck,
			shenhe,
			look,
			sfjs,
			setjffs
		}
    }
</script>


<style scoped="scoped">
	
	.ivu-table-wrapper {
		border:none;
	}
	
	.toolstipdiv{
		width: '100%';
		overflow: 'hidden';
		textOverflow: 'ellipsis';
		whiteSpace: 'normal';
		wordBreak: 'break-all';
		color:'#fff';
		text-align: center;
	}
	.toolstipdiv:hover{
		background:rgb(63, 193, 201);
	}
	
	.ivu-tooltip-rel label:hover{
		color:#0023FB;
	}
	
	.tablediv{
		height: '40px';
		overflow:'hidden';
		line-height: '40px';
	}
</style>



